package view;

import dbtools.GlobalParam;
import org.jeecgframework.core.util.PropertiesUtil;
import server.Control;
import server.Service;

public class AppTask {
	public static Control coreBusinessConntrol;
	public void StartServer()
	{

		PropertiesUtil dbProps = new PropertiesUtil("dbconfig.properties");

/*		PropertiesUtil.class.getClassLoader().getResourceAsStream(
				"dbconfig.properties");

		PropertiesUtil dbProps = new PropertiesUtil("dbconfig.properties");*/
		System.out.println("apptask开始了:"+dbProps.readProperty("jdbc.driver"));
		GlobalParam.driver=dbProps.readProperty("jdbc.driver");
		GlobalParam.username=dbProps.readProperty("jdbc.username");
		GlobalParam.password=dbProps.readProperty("jdbc.password");
		GlobalParam.url=dbProps.readProperty("jdbc.url");
		GlobalParam.urlx=dbProps.readProperty("jdbc.urlx");
		GlobalParam.maxactive=dbProps.readProperty("dbcp.maxActive");
		Control coreBusinessConntrol = new Control();
		Service.control = coreBusinessConntrol;
		coreBusinessConntrol.doStartServer();


/*		Properties p = new Properties();
		String fileName="src/resource/conf/dataSource.properties";
		try {
			InputStream in = new FileInputStream(new File(fileName));
			p.load(in);
			in.close();
			//这里有人用new FileInputStream(fileName),不过这种方式找不到配置文件。有人说是在classes下，我调过了，不行。

			System.out.println("开始了:"+p.getProperty("jdbc.driver"));
			GlobalParam.driver=p.getProperty("jdbc.driver");
			GlobalParam.username=p.getProperty("jdbc.username");
			GlobalParam.password=p.getProperty("jdbc.password");
			GlobalParam.url=p.getProperty("jdbc.url");
			GlobalParam.maxactive=p.getProperty("dbcp.maxActive");
			Control coreBusinessConntrol = new Control();
			Service.control = coreBusinessConntrol;
			coreBusinessConntrol.doStartServer();

		}catch (Exception e){



		}*/






/*		InputStream is = getClass().getResourceAsStream("/resource/.properties");
		Properties dbProps= new Properties();
		try {
			dbProps.load(is);
			GlobalParam.driver=dbProps.getProperty("jdbc.driver");
			GlobalParam.username=dbProps.getProperty("jdbc.username");
			GlobalParam.password=dbProps.getProperty("jdbc.password");
			GlobalParam.url=dbProps.getProperty("jdbc.url");
			GlobalParam.maxactive=dbProps.getProperty("dbcp.maxActive");
			
			coreBusinessConntrol = new Control();
			Service.control = coreBusinessConntrol;
			coreBusinessConntrol.doStartServer();
		} catch (IOException e) {
			e.printStackTrace();
		}*/
	}
	public static void main(String[] args)
	{
		new AppTask().StartServer();
	}
	
}
